package pattern.behavioral.state.simple;

/**
 * @author: chaoyang.ren  
 * @date:Jun 19, 2017  
 * @time:2:15:59 PM   
 * @email:chaoyang.ren@foxmail.com  
 * @version: 1.0
 */
public class Context {
	private State state;

	public State getState() {
		return state;
	}

	public void setState(State state) {
		this.state = state;
	}
	
	public void request(String sampleParameter){
		if(sampleParameter.contains("1")){
			state = new ConcreteStateOne();
		}
		else{
			state = new ConcreteStateTwo();
		}
		state.handle(sampleParameter);
	}
}

